package com.example.demo1;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;

public class Main2Activity extends Activity {

	private ImageView iv;
	private Button btn1;
	private Button btn2;
	private int[] piclist = new int[] { R.drawable.sd0004, R.drawable.sd0009,
			R.drawable.sd0005, R.drawable.sd0001, R.drawable.sd0006,
			R.drawable.sd0002, R.drawable.sd0007, R.drawable.sd0003,
			R.drawable.sd0008, R.drawable.sd0010};

	private int currentPosition = 5;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		setContentView(R.layout.activity_main2);
		initview();
	}  

	private void initview() {
		iv = (ImageView) findViewById(R.id.iv);
		btn1 = (Button) findViewById(R.id.btn1);
		btn2 = (Button) findViewById(R.id.btn2);
		iv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Main2Activity.this,MainActivity.class);
				intent.putExtra("ss", 2222222);
				setResult(22, intent);
				finish();
			}
		});
		btn1.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
//				currentPosition --; 
//				if (currentPosition<0) {
//					currentPosition = 0;
//				}
//				iv.setImageBitmap(BlurBitmapUtil.getGaoshiBitmap(Main2Activity.this, piclist[currentPosition]));
				Intent intent = new Intent(Main2Activity.this,Main3Activity.class);
				startActivity(intent);
				finish();
			
			}
		});
		btn2.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Main2Activity.this,Main3Activity.class);
				startActivityForResult(intent, 22);
				finish();
//				currentPosition ++; 
//				if (currentPosition>9) {
//					currentPosition = 9;
//				}
//				iv.setImageBitmap(BlurBitmapUtil.getGaoshiBitmap(Main2Activity.this, piclist[currentPosition]));
			}
		});

	}

}
